maintainer="Hoang Nguyen <folliekazetani@protonmail.com>"
pkgname=linuxkit
pkgver=1.5.2
pkgrel=0
pkgdesc="Toolkit for building immutable operating systems for containers"
url="https://github.com/linuxkit/linuxkit"
# 32-bit platforms: github.com/rn/iso9660wrap: integer overflow
arch="all !x86 !armhf !armv7"
license="Apache-2.0"
makedepends="go"
subpackages="$pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/linuxkit/linuxkit/archive/refs/tags/v$pkgver.tar.gz
	add-loongarch64-riscv64-support.patch"
builddir="$srcdir/$pkgname-$pkgver/src/cmd/linuxkit"

export GOCACHE="${GOCACHE:-"$srcdir/go-cache"}"
export GOTMPDIR="${GOTMPDIR:-"$srcdir"}"
export GOMODCACHE="${GOMODCACHE:-"$srcdir/go"}"

build() {
	local _goldflags="
	-X github.com/linuxkit/linuxkit/src/cmd/linuxkit/version.GitCommit=AlpineLinux
	-X github.com/linuxkit/linuxkit/src/cmd/linuxkit/version.Version=v$pkgver
	"
	go build -v -ldflags "$_goldflags"
}

check() {
	go test ./...
}

package() {
	install -Dm755 $pkgname -t "$pkgdir"/usr/bin/

	mkdir -p "$pkgdir"/usr/share/doc/linuxkit/examples
	cp -r ../../../examples/*.yml "$pkgdir"/usr/share/doc/linuxkit/examples/
}

sha512sums="
cbe2c00b07b7700d5aae17105053c27a7901048c9d0867fc8265e52f84e1ddff9e3f2836f2406a212d0f1ea6d3a0cf3b793337905e5415489fc1f634e662fe5d  linuxkit-1.5.2.tar.gz
b4791361a55a88e1d364603632e36c3c320cfb512773feb75485724903847d6fe6ad9b8b97e8d04f17c54e7bb14334b06934b42f7226908797e536020df4a6cf  add-loongarch64-riscv64-support.patch
"
